Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HamzaMath #1702

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

HamzaMath #1702

wants to merge 1 commit into from

Conversation

aya895
Copy link

@aya895 aya895 commented Sep 27, 2024

some math blocks for calculators

some math blocks for calculators
@aya895 aya895 changed the title Create HamzaMath HamzaMath Sep 28, 2024
@SharkPool-SP
Copy link
Collaborator

You cant use eval, its dangerous and can run JS code.
alert("see what I mean?")

Also, the calculate blocks are useless as you can use the "abs" block from operators. You could just add the other blocks to the Math extension

@Drago-Cuven
Copy link

Drago-Cuven commented Oct 4, 2024 via email

@SharkPool-SP
Copy link
Collaborator

Oh yeeeah a message popping on your screen to simply say something is

sooooo dangerous. Sooooo many bad things could happen. It deeefinetely be

such a catastrophe.

On Thu, Oct 3, 2024, 8:18 PM SharkPool @.***> wrote:

You cant use eval, its dangerous and can run JS code.

alert("see what I mean?")

Also, the calculate blocks are useless as you can use the "abs" block from

operators. You could just add the other blocks to the Math extension

Reply to this email directly, view it on GitHub

#1702 (comment),

or unsubscribe

https://github.com/notifications/unsubscribe-auth/ANYWUKLD3ED7SEAPDQOBWXTZZXUGHAVCNFSM6AAAAABO6XO4G2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJSGYYDCMJUGE

.

You are receiving this because you are subscribed to this thread.Message

ID: @.***>

You can run any script in JavaScript. It's an example. In reality you can download dangerous files or worse

@SharkPool-SP
Copy link
Collaborator

@Drago-Cuven now you're real silent :trollface:

@GarboMuffin GarboMuffin added the pr: new extension Pull requests that add a new extension label Oct 14, 2024
@@ -0,0 +1,178 @@
(function() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be:

(function(Scratch) {
  "use strict";

@@ -0,0 +1,178 @@
(function() {
const extension = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your extension needs to be wrapped in a class, and its block functions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually any object is fine lol

}
};

Scratch.extensions.register(extension);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be

  Scratch.extensions.register(new SPAddedMotion());
})(Scratch);

Comment on lines +137 to +142
try {
const result = eval(args.EXPRESSION);
return result;
} catch (error) {
return 'Error'; // Return error message for invalid expression
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should never be using eval like this. People will be able to run any javascript code, which is dangerous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new extension Pull requests that add a new extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants